package mil.af.amc.adpetracker.service;

import mil.af.amc.adpetracker.exceptions.DuplicateUsernameException;
import mil.af.amc.adpetracker.exceptions.EquipmentItemNotFoundException;
import mil.af.amc.adpetracker.exceptions.InvalidPasswordException;
import mil.af.amc.adpetracker.exceptions.UserNotFoundException;
import mil.af.amc.adpetracker.model.AdpeAccount;
import mil.af.amc.adpetracker.model.User;

import java.util.List;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: schevus.osborne
 * Date: Feb 1, 2007
 * Time: 12:43:24 PM
 */

public interface UserService {

    User login(String username, String password) throws UserNotFoundException, InvalidPasswordException;

    User register(Map registerMap) throws DuplicateUsernameException;

    User getUserById(int userId);

    User getUserByUsername(String username);

    User inprocessUser(Map userMap) throws ServiceException;

    void outprocessUser(int userId) throws ServiceException;

    void assignEquipmentToUser(Map dataMap) throws UserNotFoundException,
            EquipmentItemNotFoundException;

    List<User> getAll();

    List<AdpeAccount> getUserAdpeAccounts(int userId);

    // TODO: Remove this version from interface in favor of int userId version
    List<AdpeAccount> getUserAdpeAccounts(User user);
    
    void editUser(Map userMap);

    /**
     * Return all Users belonging to the organization with the given unique organization id
     *
     * @param organizationId    an int representing the unique organization id
     * @return      a List of all Users in a given Organization
     */
    List<User> getAllByOrganization(int organizationId);

    /**
     * Return all Users in a given Organization with no assigned equipment
     *
     * @param organizationId    an int representing the unique organization id
     * @return      a List of Users with no assigned equipment
     */
    List<User> getUsersWithNoAssignedEquipment(int organizationId);

    /**
     * Return all Users in a given organization with no assigned CPU
     * 
     * @param organizationId
     * @return
     */
    List<User> getUsersWithNoAssignedCpu(int organizationId);

    /**
     * Reset a user's password
     *
     * @param userId    unique id of the user who needs their password reset
     */
    void resetPassword(String email) throws ServiceException;
}
